package com.qf.mrboot2.controller;

import com.qf.mrboot2.entity.Order;
import com.qf.mrboot2.result.ResponseData;
import com.qf.mrboot2.service.OrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Order)表控制层
 *
 * @author makejava
 * @since 2021-06-02 16:14:26
 */
@RestController
@RequestMapping("order")
public class OrderController {
    /**
     * 服务对象
     * 冲突信息
     * 我是本地冲突
     */
    @Resource
    private OrderService orderService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Order selectOne(Integer id) {
        return this.orderService.queryById(id);
    }

    @ApiOperation(value = "getOne",notes = "下订单")
    @ApiImplicitParam(name = "order",value = "订单信息",dataType = "com.qf.mrboot2.entity.Order")
    @PostMapping("getOne")
    public ResponseData getOne(@RequestBody Order order){
         return orderService.insert(order);
    }

}
